package com.laborder.sysyy.service.user.impl;





import com.laborder.sysyy.dao.UserDaoMapper;
import com.laborder.sysyy.entity.User;
import com.laborder.sysyy.service.user.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;



import java.util.ArrayList;
import java.util.List;
import java.util.Map;

/**
 * @Function: 用户业务层实现类
 * @author: 786107529@qq.com FJL
 * @date:2018/8/26 11:18
 */
@Service
@Transactional
public class UserServiceImpl implements UserService {
	
	@Autowired
	private UserDaoMapper userDaoMapper;
	@Override
	public User login(Map<String,Object>map) {

		return userDaoMapper.login(map);
	}
	/**
	 * @Function: 分页查询
	 * @author: 786107529@qq.com FJL
	 * @date:2018/8/26 11:12
	 */
	@Override
	public List<User> findUserWithPage(Map<String,Object>map){
		return userDaoMapper.findUserWithPage(map);
	}
	/**
	 * @Function: 用户总数查询
	 * @author: 786107529@qq.com FJL
	 * @date:2018/8/26 11:16
	 */
	@Override
	public int getUserCount(Map<String ,Object>map){
		return userDaoMapper.getUserCount(map);
	}
	/**
	 * @Function: 添加用户信息
	 * @author: 786107529@qq.com FJL
	 * @date:2018/8/26 11:51
	 */
	@Override
	public boolean saveUserInfo(User user){
		return userDaoMapper.saveUserInfo(user);
	}
	/**
	 * @Function: 查询所有用户
	 * @author: 786107529@qq.com FJL
	 * @date:2018/8/26 12:32
	 */
	@Override
	public List<User> findAll(){
		return userDaoMapper.findAll();
	}
	/**
	 * @Function: 根据ID查询
	 * @author: 786107529@qq.com FJL
	 * @date:2018/8/26 15:14
	 */
	@Override
	public User getUserInfoById(int userId){
		return userDaoMapper.getUserInfoById(userId);
	}
	/**
	 * @Function: 更新操作
	 * @author: 786107529@qq.com FJL
	 * @date:2018/8/26 15:17
	 */
	@Override
	public boolean updateUserInfo(User user){
		return userDaoMapper.updateUserInfo(user);
	}
	/**
	 * @Function: 删除操作
	 * @author: 786107529@qq.com FJL
	 * @date:2018/8/26 15:39
	 */
	@Override
	public int delUserInfo(int userId){
		return userDaoMapper.delUserInfo(userId);
	}
	/**
	 * @Function: 修改密码
	 * @author: 786107529@qq.com FJL
	 * @date:2018/9/13 10:52
	 */
	@Override
	public boolean editPassword(User user){
		return  userDaoMapper.editPassword(user);
	}

	/**
	 * @Function: 解除权限
	 * @author: 786107529@qq.com FJL
	 * @date:2018/9/16 16:29
	 */
	@Override
	public boolean delUserRole(User user){return userDaoMapper.delUserRole(user);}

	@Override
	public User findUserByName(String userName){
		return userDaoMapper.findUserByName(userName);
	}
}
